//
//  IMIFrameworkAppDelegate.m
//  IMIFramework
//
//  Created by Travis on 09-7-25.
//  Copyright imi.im  2009. All rights reserved.
//

#import "AppDelegate.h"
#import "IMIBase.h"
#import "IMISoundPlayer.h"
//#import "IMINet.h"
#import "IMIUIImageHelper.h"

@implementation AppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
	
	window=[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
	window.backgroundColor = [UIColor whiteColor];
	window.multipleTouchEnabled=YES;
    [window makeKeyAndVisible];
	
	/*IMIBaseSelectorHolder *sh=[IMIBaseSelectorHolder shared];
	SelectorID *sid= [sh addTarget:self withSelector:@selector(showTestResult)];
	[sh performSelectorWithID:sid remove:YES];*/
	
	
	[self addEventListener:self forKey:@"showresult" withFunction:@selector(showTestResult:)];
	[self dispathcerEvent:[NSEvent eventWithKey:@"showresult" withObject:@"mwm"]];
	
}

- (void)showTestResult:(NSEvent*)event{
	/*
	//test IMIBase
	IMILog(AppDir());
	IMILog(DocDir());
	IMILog([NSString stringWithUUID]);
	IMILog([AppDir() MD5]);
	IMILog([AppDir() encodeToBase64]);
	IMILog([AppSetting description]);
	IMIDevLog(@"%f",AvailableMemory());
	IMILog(event.name);
	IMILog(event.object);
	IMILog([self className]);
	IMILog([NSString className]);
	 
	 UIImage *img=[UIImage imageWithContentsOfURL:[NSURL URLWithString:@"http://i375.photobucket.com/albums/oo198/Chialin1006/zoompanda/hpiodid9.jpg"]];
	 
	 
	 UIImageView *imgv=[[UIImageView alloc] initWithImage:img];
	 //imgv.frame=CGRectMake(0, 0, 200, 300);
	 window.backgroundColor=[UIColor grayColor];
	 [window addSubview:imgv];
	 
	 IMILog([NSString MD5OfFile:Resource(@"machinegun.caf", nil)]);
	*/
	MARK;
	
	[UIApplication showSVNVersion];
	/*
	//test IMISound
	[[IMISoundPlayer sharedPlayer] preloadEffect:Resource(@"machinegun.caf", nil)];
	[[IMISoundPlayer sharedPlayer] playEffect:Resource(@"machinegun.caf", nil) loop:YES];
	[[IMISoundPlayer sharedPlayer] performSelector:@selector(stopEffect:) withObject:Resource(@"machinegun.caf", nil) afterDelay:4];
	*/
	//
	[self removeEventListener:self forKey:event.name];
}

- (void)dealloc {
    [window release];
    [super dealloc];
}


@end
